<template>
	<view>
		<view class="outermost_box">
			<view class="topContent">
				<view
					class="main_content"
					v-for="(item, index) in dataCardList"
					:key="index"
					@click="particulars(item)"
				>
					<view class="title_content">
						<view
							class="title"
							style="color: #000; font-size: 32rpx; font-weight: bold"
							><view>姓名：</view> <text>{{ item.patientName }}</text></view
						>
						<view class="title"
							><view>证件号：</view> <text>{{ item.userIdcode }}</text></view
						>
						<view class="title"
							><view>手机号：</view>
							<text>{{ item.patientTelephone }}</text></view
						>
					</view>
					<!-- 二维码 -->
					<!-- <view style="width: 30%">
					
					</view> -->
				</view>
			</view>
			<view style="margin-top: 50rpx">
				<u-button type="primary" @click="addHealth">绑定健康卡</u-button>
			</view>
		</view>
		<view class="safe"></view>
	</view>
</template>

<script>
import { findBindCard } from '../../http/api'
import { mapState } from 'vuex'
export default {
	data() {
		return {
			selectShowContent: '您未选择就诊医院',
			dataCardList: [],
		}
	},
	computed: {
		...mapState({
			userId: state => state.userId,
			orgId: state => state.orgId,
		}),
	},
	onShow() {
		findBindCard({
			userId: this.userId,
			orgId: this.orgId,
			cardType: '2',
		}).then(({ data }) => {
			this.dataCardList = data
		})
	},
	onUnload: function () {
		//页面被卸载时被执行
		uni.switchTab({
			url: '/pages/tabbar_my/index',
		})
	},
	methods: {
		addHealth() {
			console.log('123')
			this.$router.navigateTo({
				url: '/pages/healthCard/addHealth',
			})
		},
		particulars(item) {
			console.log(item)
			this.$router.navigateTo({
				url: '/pages/healthCard/particulars?parameter=' + JSON.stringify(item),
			})
		},
	},
}
</script>

<style lang="scss">
page {
	background: rgba(243, 244, 246, 0.3);
}
.outermost_box {
	padding: 20rpx;
	.main_content {
		display: flex;
		background: #fff;
		padding: 30rpx;
		box-shadow: 0 0 5px 1px rgba(0, 0, 0, 0.1);
		.title {
			padding: 10rpx;
			color: #ccc;
			view {
				min-width: 110rpx;
				display: inline-block;
			}
		}
	}
}

.safe {
	height: 0;
	height: constant(safe-area-inset-bottom);
	height: env(safe-area-inset-bottom);
}
</style>